import type { TFilterValue } from "@/types";
import { http } from "@/utils/fetch";

export const FUNDER_FIND_ALL = "/funder/findAll";
export const MAINPART_FIND_ALL = "/funder/findAllFunderGlobalMainPart";
export const FMR_FIND_ALL = "/funder/relatedInfo/findAll";

/**
 * 获取资方信息列表
 * @param currentPage 当前页数
 * @param pageSize 分页容量
 * @param filterValue 筛选 DTO
 * @returns
 */
export const getFunderList = async (currentPage: number, pageSize: number, filterValue?: TFilterValue) => {
  return await http("POST", `${FUNDER_FIND_ALL}?currentPage=${currentPage}&pageSize=${pageSize}`, filterValue);
};

/**
 * 获取外国主体信息列表
 * @param currentPage 当前页数
 * @param pageSize 分页容量
 * @param filterValue 筛选 DTO
 * @returns
 */
export const getMainPartList = async (currentPage: number, pageSize: number, filterValue?: TFilterValue) => {
  return await http("POST", `${MAINPART_FIND_ALL}?currentPage=${currentPage}&pageSize=${pageSize}`, filterValue);
};

/**
 * 获取资方-外国主体信息关联表
 * @param currentPage 当前页数
 * @param pageSize 分页容量
 * @param filterValue 筛选 DTO
 * @returns
 */
export const getFMRList = async (currentPage: number, pageSize: number, filterValue?: TFilterValue) => {
  return await http("POST", `${FMR_FIND_ALL}?currentPage=${currentPage}&pageSize=${pageSize}`, filterValue);
};

/**
 * 获取信用险额度表
 * @param customerId 客户ID
 * @returns
 */
export const getCreditList = async (customerId: string) => {
  return await http("POST", `/customer/credit/findCreditByCustomerId?customerId=${customerId}`);
};
